import asyncio
from botpy import logging

from botpy.message import GroupMessage
import datetime

_log = logging.get_logger()


class UserProcessor:
    __slots__ = (
    )

    async def on_register(self, msg: GroupMessage):
        user = self.user_initialize(msg)
        start_cultivate = await msg._api.post_group_message(
            group_openid=msg.group_openid,
            msg_type=0,
            msg_id=msg.id,
            content=f"\n欢迎进入璃月修仙世界，你的道号是：{user}")
        _log.info(start_cultivate)

    async def user_initialize(self, msg: GroupMessage):
        # todo 校验是否用户存在
        user_id = msg.author.member_openid

        return user_id, True
